<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  

<title>K线图-更新速度测试(50ms)</title>  
    <!-- 加载资源 -->
    <link rel="stylesheet" href="../jscommon/umychart.resource/css/tools.css" />
    <link rel="stylesheet" href="../jscommon/umychart.resource/font/iconfont.css" />
</head>  
<body>
    <div id="kline" >
       
    </div>

    <div>
        
    </div>

    <script src="../jscommon/umychart.resource/js/jquery.min.js"></script>
    <script src="../jscommon/umychart.resource/js/webfont.js"></script>
    <script src='../jscommon/umychart.console.js'></script>     <!-- 日志输出 -->
    <script src="../jscommon/umychart.network.js"></script>     <!-- 网络请求分装 -->
    <script src="../jscommon/umychart.js"></script>             <!-- K线图形 -->
    <script src="../jscommon/umychart.complier.js"></script>    <!-- 麦语言解析执行器 -->
    <script src="../jscommon/umychart.index.data.js"></script>  <!-- 基础指标库 -->
    <script src="../jscommon/umychart.style.js"></script>       <!-- 白色风格和黑色风格配置信息 -->
   
    <script src="../jscommon/umychart.NetworkFilterTest.js"></script>
   
    
    <script>

      
        JSConsole.Chart.Log=() =>{}
        JSConsole.Complier.Log=()=>{}
        MARKET_SUFFIX_NAME.GetMarketStatus = function (symbol)  { return 2; }

        //简单的把K线控件封装下
        function KLineChart(divKLine)
        {
            this.DivKLine=divKLine;
            this.Chart=JSChart.Init(divKLine, false, true);   //把K线图绑定到一个Div上
           
            //K线配置信息
            this.Option= {
                Type:'历史K线图',   //创建图形类型
                //Type:'历史K线图横屏',

                //EnableBorderDrag:false,
                
                Windows: //窗口指标
                [
                    {Index:"BOLL" , IsSync:true },
                    {Index:"MACD2",IsSync:true },
                    {Index:"RSI", IsSync:true },
                ], 

                
                OverlayIndex:
                [
                  
                ],  //叠加指标
                
                //DragDownload: { Day:{ Enable:true } , Minute:{ Enable:true }}, 
                //Symbol:'600519.sh',
                Symbol:"000016.sz",
                IsAutoUpdate:true,       //是自动更新数据
                AutoUpdateFrequency:50,   //数据更新频率
                //TradeIndex: {Index:'交易系统-BIAS'},    //交易系统

                SplashTitle:'加载数据中......',
    
                IsShowRightMenu:false,          //右键菜单
                //CorssCursorTouchEnd:true,
                //IsClickShowCorssCursor:true,
                IsCorssOnlyDrawKLine:true,

                CtrlMoveStep:10,

                CorssCursorInfo: { Right:2, DateFormatType:3, HPenType:1, VPenType:1, IsShowClose:false, VLineType:0,RightButton:{ Enable:true }, IsShowCorss:true, PriceFormatType:0, DataFormatType:0 },
                EnableZoomIndexWindow:true,

                DrawTool:       //画图工具
                {
                    //StorageKey:'4E7EA133-D6C8-4776-9869-1DDDCC5FA744'
                },
    
                KLine:  //K线设置
                {
                    DragMode:1,                 //拖拽模式 0=禁止拖拽 1=数据拖拽 2=区间选择
                    Right:1,                    //复权 0 不复权 1 前复权 2 后复权
                    Period:4,                   //周期 0 日线 1 周线 2 月线 3 年线 
                    MaxRequestDataCount:3000,   //数据个数
                    MaxRequestMinuteDayCount:5, //分钟数据获取几天数据  默认取5天数据
                    PageSize:30,               //一屏显示多少数据
                    //Info:["公告"], 
                    IsShowTooltip:true,                 //是否显示K线提示信息
                    DrawType:0,      //K线类型 0=实心K线柱子 1=收盘价线 2=美国线 3=空心K线柱子 4=收盘价面积图
                    //FirstShowDate:20161201,
                    KLineDoubleClick:false, //禁止双击弹框
                    RightSpaceCount:5,
                    ZoomType:0,
                    
                    //DataWidth:5
                    ShowKLine:true,
                },

                StepPixel:0,

                IsDrawPictureXY:true,

                Listener:
                {
                    //KeyDown:false,
                    //Wheel:false
                },

                EnableFlowCapital:
                {
                    BIT:true
                },

                SelectedChart:{ EnableSelected: true, EnableMoveOn:true },
                EnableIndexChartDrag:true,
    
                KLineTitle: //标题设置
                {
                    IsShowName:false,       //不显示股票名称
                    IsShowSettingInfo:true, //不显示周期/复权
                    IsTitleShowLatestData:true,
                },
    
                EnableYDrag:
                {
                    Right:true,
                    Left:true,
                },
                
                Border: //边框
                {
                    Left:50,         //左边间距
                    Right:90,       //右边间距
                    Bottom:25,      //底部间距
                    Top:25,         //顶部间距

                    AutoLeft:{ Blank:10, MinWidth:30 },
                    AutoRight:{ Blank:5, MinWidth:40 },
                },
                
                Frame:  //子框架设置
                [
                    {
                        Custom:
                        [
                            { 
                                Type:0,
                                Position:'right', //CountDown:true 
                            },
                        ]
                        
                        
                        
                    },

                    { SplitCount:5 },
                    
                ],

                ExtendChart:    //扩展图形
                [
                    //{Name:'KLineTooltip' },  //手机端tooltip
                    //{Name:"FrameSplitPaint", LineColor:"rgb(200,0,0)" }
                ],


                Overlay:
                [
                    //{Symbol:'399300.sz', DrawType:1, Color:'rgb(0,0,255)'},
                    //{ Symbol:'600999.sh' }
                ],
            };
                 
            this.Create=function()  //创建图形
            {
                var self=this;
                //$(window).resize(function() { self.OnSize( {Type:1} ); });    //绑定窗口大小变化事件
                $(window).resize(function() { self.OnSize( ); });    //绑定窗口大小变化事件

                var blackStyle=HQChartStyle.GetStyleConfig(STYLE_TYPE_ID.BLACK_ID); //读取黑色风格配置
                //blackStyle.DRAWICON={ MinSize:20 , MaxSize:60};
                //blackStyle.DrawPicture.PointType=1;


                //JSChart.SetStyle(blackStyle);
                //this.DivKLine.style.backgroundColor=blackStyle.BGColor; //设置最外面的div背景

                JSChart.GetResource().FrameLogo.Text=null;

                this.OnSize();  //让K线全屏
                this.Option.NetworkFilter=(data, callback)=>{ this.NetworkFilter(data, callback); }
                this.Chart.SetOption(this.Option);  
            }

            this.NetworkFilter=function(data, callback)
            {
                console.log('[NetworkFilter] data', data);

                HQData.NetworkFilter(data, callback);
            }

            this.OnSize=function(option)  //自适应大小调整
            {
                var height= $(window).height()-50;
                var width = $(window).width();
                //width=50000;
                this.DivKLine.style.top='0px';
                this.DivKLine.style.left='0px';
                this.DivKLine.style.width=width+'px';
                this.DivKLine.style.height=height+'px';
                this.Chart.OnSize(option);
            }

            this.ChangeSymbol=function(symbol)
            {
                this.Chart.ChangeSymbol(symbol);
            }
        }

        $(function () 
        {
            var klineControl=new KLineChart(document.getElementById('kline'));
            klineControl.Create();
        })

       

    </script>  
</body>  
</html>



<style>

#kline
{
    width: 900px;
    height:400px;
    position: relative;
    /*margin-top: 100px;*/
}

.btn-style
{
    padding: 3px 8px;
    border: 1px solid #ececec;
    border-radius: 5px;
    background-color: #f5f5f5;
    cursor: pointer;
}

    
</style>